<div class="bjui-pageContent">
	@if($method=='add')
	<form action="{{url('admin/user/userAdd')}}" data-toggle="validate" method="post" data-close-current="true">
    	{{csrf_field()}}
        <div class="bjui-row col-1">
            <label class="row-label">所属用户组:</label>
            <div class="row-input">
            	<select name="g_id[]" data-toggle="selectpicker" data-width="200" multiple="">
                    @foreach($groups as $v)
                        <option value="{{$v->id}}">{{$v->name}}</option>
                    @endforeach
                </select>
            </div>
            <label class="row-label">登陆账号:</label>
            <div class="row-input required">
            	<input type="text" id="email" name="email" value="" data-rule="required;email">
            </div>
            <label class="row-label">昵称:</label>
            <div class="row-input required">
                <input type="text" id="nickname" name="nickname" value="" data-rule="昵称:required">
            </div>
            <label class="row-label">密码:</label>
            <div class="row-input required">
                <input type="password" id="password" name="password" value="" data-rule="新密码:required;length(6~)">
            </div>
        </div>
    </form>
	@elseif($method=='edit')
    <form action="{{url('admin/user/userEdit')}}" data-toggle="validate" method="post" data-close-current="true">
    	{{csrf_field()}}
        <div class="bjui-row col-1">
        	<input type="hidden" id="id" name="id" value="{{$user->id}}">
            <label class="row-label">所属用户组:</label>
            <div class="row-input">
            	<select name="g_id[]" id="groupid" data-toggle="selectpicker" data-width="200" multiple="">
                    @foreach($groups as $v)
                        <option value="{{$v->id}}"
                                @if(count($groupid)>0)
                                    @if(in_array($v->id,$groupid))
                                        selected="selected"
                                    @endif
                                @endif
                        >{{$v->name}}</option>
                    @endforeach
                </select>
            </div>
            <label class="row-label">登陆账号:</label>
            <div class="row-input required">
            	<input type="text" id="email" name="email" value="{{$user->email}}" data-rule="required;email" readonly="readonly">
            </div>
            <label class="row-label">昵称:</label>
            <div class="row-input required">
                <input type="text" id="nickname" name="nickname" value="{{$user->nickname}}" data-rule="昵称:required">
            </div>
            <label class="row-label">密码:</label>
            <div class="row-input">
                <input type="password" id="newpass" name="password" value="" data-rule="新密码:length(6~)">
            </div>
            <label class="row-label">确认密码:</label>
            <div class="row-input">
                <input type="password" id="password_c" name="password_confirmation" value="" data-rule="新密码:match(#newpass)">
            </div>
        </div>
    </form>
    @endif
    
</div>
<div class="bjui-pageFooter">
    <ul>
        <li><button type="button" class="btn-close" data-icon="close">关闭</button></li>
        <li><button type="submit" class="btn-default" data-icon="check">保存</button></li>
    </ul>
</div>